import { defaultRequest as rq } from "./request";
import type { R } from "./request";

// const baseURL = 'http://localhost:9999'
// const baseURL = 'http://192.168.31.6:9999'
const baseURL = 'https://www.wangyunf.com/xzserver/'


export const userinfoApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/user/blossom/info", p);
}

export const docTreeApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/doc/trees/open", p);
}

export const subjectsApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/folder/subjects", p);
}

// --------------------------------------------------< 文章 >--------------------------------------------------

export const articleHeatmapApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/article/stat/heatmap", p);
}

export const articleWordLineApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/article/stat/line", p);
}

export const articleInfoOpenApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/article/open/info", p);
}

// --------------------------------------------------< 三方接口 >--------------------------------------------------

export const yuqueHeatmapApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/yuque/heatmap", p);
}

export const giteeHeatmapApi = (params?: object): Promise<R<any>> => {
  let p: object = { params: params, baseURL: baseURL }
  return rq.get<R<any>>("/gitee/heatmap", p);
}